package com.example.demo.controller;

import com.example.demo.service.HotSearchWordService;
import com.example.demo.service.impl.HotSearchWordServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/hot-search-words")
public class HotSearchWordController {

    private final HotSearchWordService hotSearchWordService;

    @Autowired
    public HotSearchWordController(HotSearchWordServiceImpl hotSearchWordServiceImpl){
        this.hotSearchWordService = hotSearchWordServiceImpl;
    }

    @GetMapping("/get/list")
    public List<String> getAll() {
        // Sort.by(Sort.Direction.ASC, "sort")
        System.out.println("调用了 List<HotSearchWord> getAll()");
        return hotSearchWordService.findAll();
    }
}
